<%- outputContent();%><%  -%>
<%

function simplifyContent(str){
    var reg = /<pre>(.*?)[\s\S]*?<\/code><\/pre>/gi;
    var s = str.replace(reg,"");
    return s.replace(/(<(\/?)(\w+)[^>]*>)|([\s\S]*?)/g ,'')//去除html标签如<p></p>和注释
    .replace(/\s+/g,' ')//压缩空格换行等只保留一个空格
}

function outputContent(){
let articlesContent={
   posts:[]
};

site.posts.forEach(function(post, index){
   if(!post.hideInList){
      let postContent={
         title:post.title,
         content:simplifyContent(post.content),
         link:post.link
      };
      articlesContent.posts.push(postContent);
   }
})
return JSON.stringify(articlesContent);
}
%>